package com.wanmait.movie.controller;

import com.wanmait.movie.entity.request.manage.ManageLoginRequest;
import com.wanmait.movie.service.ManageService;
import com.wanmait.movie.util.AjaxResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("manage")
public class ManageIndexController {
    /**
     * 管理员根据管理员名和密码进行登录
     */
    @Resource
    private ManageService manageService;
    @PostMapping("/login")
    public AjaxResult login(@RequestBody ManageLoginRequest manageLoginRequest, HttpServletRequest request){
        // 登录信息不能为空
        if (manageLoginRequest == null){
            return AjaxResult.error(400,"登录信息为空");
        }
        return manageService.login(manageLoginRequest,request);
    }

    @GetMapping("isLogin")
    public AjaxResult isLogin(){
        return AjaxResult.success();
    }
}
